package com.neusoft.carsale.util;

import java.util.UUID;

public class PasswordUtils {
	public static boolean matches(String salt,String rawPass,String encPass) {
		return new PasswordEncoder(salt).matches(encPass, rawPass);
	}
	public static String encode(String rawPass,String salt) {
		return new PasswordEncoder(salt).encode(rawPass);
	}
	
	public static String getSalt() {
		return UUID.randomUUID().toString().replaceAll("-", "").substring(0,20);
	}
	
	public static void main(String[] args) {
		String salt=getSalt();
		String pass=encode("666",salt);
		System.out.println(salt);
		System.out.println(pass);
	}
}
